package com.lilinling.yinzhi.model.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.lilinling.yinzhi.model.entity.PanelContentEntity;
import com.lilinling.yinzhi.model.service.PanelContentService;
import com.lilinling.common.utils.PageUtils;
import com.lilinling.common.utils.R;



/**
 * 
 *
 * @author lichenglin
 * @email lilinling15@gmail.com
 * @date 2021-03-12 16:30:41
 */
@RestController
@RequestMapping("model/panelcontent")
public class PanelContentController {
    @Autowired
    private PanelContentService panelContentService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("model:panelcontent:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = panelContentService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("model:panelcontent:info")
    public R info(@PathVariable("id") Integer id){
		PanelContentEntity panelContent = panelContentService.getById(id);

        return R.ok().put("panelContent", panelContent);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("model:panelcontent:save")
    public R save(@RequestBody PanelContentEntity panelContent){
		panelContentService.save(panelContent);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("model:panelcontent:update")
    public R update(@RequestBody PanelContentEntity panelContent){
		panelContentService.updateById(panelContent);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("model:panelcontent:delete")
    public R delete(@RequestBody Integer[] ids){
		panelContentService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
